package edu.nynu.cityeasy.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 工单主表 (报修/投诉)
 * @TableName work_order
 */
@TableName(value ="work_order")
@Data
public class WorkOrder implements Serializable {
    /**
     * 工单ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 工单类型: 报修, 投诉
     */
    private Object type;

    /**
     * 提交人ID (业主/住户, 关联 user_account.id)
     */
    private Long submitterId;

    /**
     * 关联房屋ID (关联 unit.id, 明确问题地点)
     */
    private Long unitId;

    /**
     * 工单标题/摘要 (如 "卫生间漏水")
     */
    private String title;

    /**
     * 工单详情描述
     */
    private String content;

    /**
     * 状态: 待处理, 已指派(处理中), 已处理(待验收), 已关闭(已验收), 已取消
     */
    private Object status;

    /**
     * 当前处理人ID (物业/外包, 关联 user_account.id)
     */
    private Long assigneeId;

    /**
     * 指派时间
     */
    private Date assignedAt;

    /**
     * 处理完成时间
     */
    private Date completedAt;

    /**
     * 处理结果描述 (由处理人填写)
     */
    private String resultNotes;

    /**
     * 评价星级 (1-5)
     */
    private Integer evaluationRating;

    /**
     * 评价内容
     */
    private String evaluationComment;

    /**
     * 评价时间
     */
    private Date evaluatedAt;

    /**
     * 
     */
    private Integer isDeleted;

    /**
     * 
     */
    private Date deletedAt;

    /**
     * 
     */
    private Long deletedBy;

    /**
     * 
     */
    private Date createdAt;

    /**
     * 
     */
    private Date updatedAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        WorkOrder other = (WorkOrder) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getSubmitterId() == null ? other.getSubmitterId() == null : this.getSubmitterId().equals(other.getSubmitterId()))
            && (this.getUnitId() == null ? other.getUnitId() == null : this.getUnitId().equals(other.getUnitId()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getAssigneeId() == null ? other.getAssigneeId() == null : this.getAssigneeId().equals(other.getAssigneeId()))
            && (this.getAssignedAt() == null ? other.getAssignedAt() == null : this.getAssignedAt().equals(other.getAssignedAt()))
            && (this.getCompletedAt() == null ? other.getCompletedAt() == null : this.getCompletedAt().equals(other.getCompletedAt()))
            && (this.getResultNotes() == null ? other.getResultNotes() == null : this.getResultNotes().equals(other.getResultNotes()))
            && (this.getEvaluationRating() == null ? other.getEvaluationRating() == null : this.getEvaluationRating().equals(other.getEvaluationRating()))
            && (this.getEvaluationComment() == null ? other.getEvaluationComment() == null : this.getEvaluationComment().equals(other.getEvaluationComment()))
            && (this.getEvaluatedAt() == null ? other.getEvaluatedAt() == null : this.getEvaluatedAt().equals(other.getEvaluatedAt()))
            && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()))
            && (this.getDeletedAt() == null ? other.getDeletedAt() == null : this.getDeletedAt().equals(other.getDeletedAt()))
            && (this.getDeletedBy() == null ? other.getDeletedBy() == null : this.getDeletedBy().equals(other.getDeletedBy()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getSubmitterId() == null) ? 0 : getSubmitterId().hashCode());
        result = prime * result + ((getUnitId() == null) ? 0 : getUnitId().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getAssigneeId() == null) ? 0 : getAssigneeId().hashCode());
        result = prime * result + ((getAssignedAt() == null) ? 0 : getAssignedAt().hashCode());
        result = prime * result + ((getCompletedAt() == null) ? 0 : getCompletedAt().hashCode());
        result = prime * result + ((getResultNotes() == null) ? 0 : getResultNotes().hashCode());
        result = prime * result + ((getEvaluationRating() == null) ? 0 : getEvaluationRating().hashCode());
        result = prime * result + ((getEvaluationComment() == null) ? 0 : getEvaluationComment().hashCode());
        result = prime * result + ((getEvaluatedAt() == null) ? 0 : getEvaluatedAt().hashCode());
        result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
        result = prime * result + ((getDeletedAt() == null) ? 0 : getDeletedAt().hashCode());
        result = prime * result + ((getDeletedBy() == null) ? 0 : getDeletedBy().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", type=").append(type);
        sb.append(", submitterId=").append(submitterId);
        sb.append(", unitId=").append(unitId);
        sb.append(", title=").append(title);
        sb.append(", content=").append(content);
        sb.append(", status=").append(status);
        sb.append(", assigneeId=").append(assigneeId);
        sb.append(", assignedAt=").append(assignedAt);
        sb.append(", completedAt=").append(completedAt);
        sb.append(", resultNotes=").append(resultNotes);
        sb.append(", evaluationRating=").append(evaluationRating);
        sb.append(", evaluationComment=").append(evaluationComment);
        sb.append(", evaluatedAt=").append(evaluatedAt);
        sb.append(", isDeleted=").append(isDeleted);
        sb.append(", deletedAt=").append(deletedAt);
        sb.append(", deletedBy=").append(deletedBy);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}